<?php

namespace App\Http\Requests\Message;

use App\Http\Requests\AbstractApiRequest;
use Dingo\Api\Http\FormRequest;
use Illuminate\Validation\ValidationException;

class Store extends AbstractApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

     /**
      * Get the validation rules that apply to the request.
      *
      * @return array
      */
     public function rules()
     {
        return [
            'name' => 'required',
            'email' => 'required|email',
            'city' => 'required',
            'description' => 'required',
        ];
     }

     /**
      * 获取已定义验证规则的错误消息。
      *
      * @return array
      */
     public function messages()
     {
        return [
            'name.required' => '姓名不能为空',
            'email.required' => '邮箱不能为空',
            'email.email' => '邮箱格式不对',
            'city.required' => '城市不能为空',
            'description.required' => '诉求不能为空',
        ];
    }
}
